package tech.aistar.controller.adopt;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import tech.aistar.entity.adopt.CatVo;
import tech.aistar.entity.mycat.CatSpecies;
import tech.aistar.service.adopt.IAdoptCatService;
import tech.aistar.service.adopt.ICatVoService;
import tech.aistar.service.mycat.ICatSpeciesService;

import java.util.List;

/**
 * Created by 陆锦鹏 on 2019/9/25.
 */
@Controller
@RequestMapping("/adoptCat")
public class AdoptCatController {

    @Autowired
    private ICatSpeciesService catSpeciesService;

    @Autowired
    private ICatVoService catVoService;

    //跳转到领养猫咪的显示页面
    @RequestMapping("/adoptCatView")
    public String adoptCatView(Model model,Integer catSpeciesId){

        CatSpecies catSpecies = catSpeciesService.findById(catSpeciesId);

        String speciesName = catSpecies.getSpeciesName();

        List<CatVo> catVos = catVoService.findAll();

        model.addAttribute("catVos",catVos);

        List<CatSpecies> catSpeciesList = catSpeciesService.findAll();

        model.addAttribute("catSpeciesList",catSpeciesList);

        return "adopt/adoptCat";
    }

    //跳转到填写领养表界面
    @RequestMapping("/adoptCreateView")
    public String adoptCreateView(){
        return "adopt/adoptCreate";
    }

    //跳转到
    @RequestMapping("/catInfoView")
    public String catInfoView(){
        return "adopt/catInfo";
    }

}
